<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>父元素添加overflow</title>

    <style>
        .box {
            overflow: hidden;
            border: 1px solid red;
        }

        .div1 {
            float: left;
            background-color: pink;
            width: 200px;
            height: 200px;
        }

        .div2 {
            float: left;
            background-color: powderblue;
            width: 300px;
            height: 300px;
        }

        .footer {
            height: 300px;
            background-color: black;
        }

    </style>

</head>
<body>

    <img src="清除浮动-overflow.png" alt="">
    
    <div class="box">
        <div class="div1">1</div>
        <div class="div2">2</div>
    </div>

    <div class="footer">footer</div>

</body>
</html>